void setup() {
  // put your setup code here, to run once:
  Serial.begin(115200);
  pinMode(PA6, OUTPUT);
  pinMode(PA7, OUTPUT);
  digitalWrite(PA6, LOW);
  digitalWrite(PA7, LOW);
}

void loop() {
  // put your main code here, to run repeatedly:
  if (Serial.available() > 0) {
    int responsedata = Serial.read();
    if (responsedata != -1) {

      if (responsedata == 0x01) {
        digitalWrite(PA6, HIGH);
        digitalWrite(PA7, LOW);
        // 正转
      }

      if (responsedata == 0x02) {
        digitalWrite(PA7, HIGH);
        digitalWrite(PA6, LOW);
        // 反转
      }


      if (responsedata == 0x03) {
        digitalWrite(PA7, LOW);
        digitalWrite(PA6, LOW);
        // 停止
      }

      Serial.write(responsedata);
    }
    
  }
}
